-
Notifications
You must be signed in to change notification settings - Fork 270
[OpenVINO] Introduce a way to control resetting of the state of stateful OV models #3714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nikita-savelyevv
wants to merge
8
commits into
openvinotoolkit:develop
Choose a base branch
from
nikita-savelyevv:ns/stateful-models-quantization
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[OpenVINO] Introduce a way to control resetting of the state of stateful OV models #3714
nikita-savelyevv
wants to merge
8
commits into
openvinotoolkit:develop
from
nikita-savelyevv:ns/stateful-models-quantization
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
Author
|
Example usage: huggingface/optimum-intel#1505 |
db81db1 to
5f7518b
Compare
AlexanderDokuchaev
requested changes
Nov 28, 2025
| # between model inferences. This key can be added to a dataset sample input dictionary with either | ||
| # `True` or `False` value. With `True` value, the model state will be reset before inference on the corresponding | ||
| # sample, and with `False` the state will not be reset. | ||
| RESET_STATE_KEY = "nncf_reset_state" |
Collaborator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like incorrect place for definition of variable.
May be better define it in src/nncf/definitions.py ?
And for users add note in docstring of Dataset that it can be use stateful models
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Added
nncf.Dataset.RESET_STATE_KEYconstant to specify when to reset model state. This constant is used by OpenVINO backend to control resetting of internal model state between model inferences. This key can be added to a dataset sample input dictionary with eitherTrueorFalsevalue. WithTruevalue, the model state will be reset before inference on the corresponding sample, and withFalsethe state will not be reset.For an example of usage please see huggingface/optimum-intel#1505.
Reason for changes
Without this logic static quantization quality of stateful Whisper models is poor because a state of a stateful model must be cleared with the same schedule as it is done during calibration input data collection.
Related tickets
172705
Tests
Added
tests/openvino/native/test_engine.py::test_stateful_model_inference_with_controlled_resetting.